<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>ToonWatch &raquo;<g:layoutTitle default="Welcome" /></title>
    <resource:autoComplete skin="default" />
    <link rel = "stylesheet" href ="<g:createLinkTo dir='css' file='commonStyle.css' />" />
    <link rel="shortcut icon" href="${resource(dir:'images',file:'favicon.ico')}" type="image/x-icon" />
    <g:layoutHead />
    <g:javascript library="application" />
  </head>
  <body>
    <sec:ifLoggedIn>
    <ul id="shoppingTab">
      <li class="cart"><g:if test="${session.numCart}"><g:link controller ="cart" action ="viewCart" title="${session.numCart} item(s) in the shopping cart"><span>${session.numCart}</span></g:link></g:if><g:else><g:link controller ="cart" action ="viewCart" title="0 item in the shopping cart"><span>0</span></g:link></g:else></li>
      <li class="voucher"><g:link uri='/voucher/issueVoucher.gsp' absolute="true" title="Voucher of ${session.userVoucher} in your account"><span><g:if test="${session.user}"><g:formatNumber number="${session.userVoucher}" type="number" minFractionDigits="2" maxFractionDigits="2" /></g:if><g:else>Error!</g:else></span></g:link></li>
    </ul>
      </sec:ifLoggedIn>
    <ul id="followTab">
      Follow us!
      <sec:ifLoggedIn>
      <li><a class="newsletter" href="http://toonwatch.comp.nus.edu.sg/voucher/newsletterUI" title="Subscribe to the ToonWatch.com newsletter"><span>Subscribe to the ToonWatch.com newsletter</span></a></li>
      </sec:ifLoggedIn>
      <li><a class="facebook" href="http://www.facebook.com/pages/toonwatch/277605362280338" title="Follow ToonWatch.com on Facebook"><span>Follow ToonWatch.com on Facebook</span></a></li>
      <li><a class="google" href="http://plus.google.com/u/0/100796135588275223599/posts" title="Follow ToonWatch.com on Google Plus"><span>Follow ToonWatch.com on Google Plus</span></a></li>
      <li><a class="twitter" href="http://twitter.com/#!/Toonwatch1" title="Follow ToonWatch.com on Twitter"><span>Follow ToonWatch.com on Twitter</span></a></li>
    </ul>
    <div class="wrapper">
      <div class="logo">
        <div><g:link uri='/home.gsp' absolute="true"><img src="${resource(dir: 'images', file: 'toonwatch_logo.png')}" alt="Home"/></img></g:link></div>
        <div class="wrapper2">
          <div id="statusTab"> 
            <sec:ifLoggedIn>Hi <g:if test="${session.user}">${session.user.name} ${session.user.lastname}</g:if><g:else><sec:username/></g:else> <g:link controller='logout'>[Logout]</g:link>
            </sec:ifLoggedIn>
            <sec:ifNotLoggedIn> Welcome to ToonWatch.com <g:link controller='login'> Login </g:link> here!
            </sec:ifNotLoggedIn>
          </div>
        </div>
      </div>
      <div id="navbod">
        <ul id="nav">
          <li class="current"><g:link uri='/home.gsp' absolute="true">Home</g:link></li>
          <li><g:link uri='/newArrival.gsp' absolute="true">New Arrival</g:link></li>
          <li><a href="#">Products</a>
            <ul>
              <li><g:link controller='category' action='listUI' absolute="true">Category</g:link>
                <ul>
                  <g:each var="nextCat" in="${org.toonWatch.Category.list(sort:'name', order:'asc')}">
                    <li><g:link controller="category" action="showUI" id="${nextCat.id}" absolute="true">${nextCat.name}</g:link></li>
                  </g:each>
                </ul>
              </li>
              <li><g:link controller='item' action='showSearch' absolute="true">Search</g:link></li>
            </ul>
          </li>
          <sec:ifLoggedIn>
            <li><a href="#">Account</a>
              <ul>
                <li><g:link controller='user' action='userProfile' absolute="true">Profile</g:link></li>
                <li><g:link controller='user' action='passwordEdit' absolute="true">Change Password</g:link></li>
                <li><g:link controller='transaction' action='viewCart' absolute="true">Transaction History</g:link></li>
              </ul>
            </li>
          </sec:ifLoggedIn>
          <li><g:link uri='/contactUs.gsp' absolute="true">Contact Us</g:link></li>
          <div id="basicSearch">
            <g:form controller="item" action="simpleSearch" absolute="true">
              <input name="name" type="text" value="${name}"/></td>
              <g:submitButton name="Go" controller="item" action="simpleSearch" absolute="true">
              </g:submitButton>
            </g:form>
          </div>
        </ul>
      </div>
      <div id="content">
        <g:layoutBody />
      </div>
      <div id="footer">
        &copy; Copyright 2011. All right reserved. ToonWatch.com
      </div>
    </div>
  </body>
</html>
